#![feature(step_trait)]
#![feature(test)]

use std::iter::Step;

struct InclusiveRangeIter<A: Step> {
    cur: A,
    end: A,
    done: bool
}

impl<A: Step> InclusiveRangeIter<A> {
    fn new(start: A, end: A) -> Self {
        Self { cur: start, end, done: false }
    }
}

impl<A: Step> Iterator for InclusiveRangeIter<A> {
    type Item = A;

    #[inline]
    fn next(&mut self) -> Option<Self::Item> {
        if self.done { return None }
        Some(if self.cur < self.end {
            let next = Step::forward_checked(self.cur.clone(), 1).expect("No!");
            std::mem::replace(&mut self.cur, next)
        } else {
            self.done = true;
            self.cur.clone()
        })
    }
}

const BAD: u32 = 69;

#[inline(never)]
fn sum_of_all_good<const A: u8>(n: u32) -> u64 {
    let mut sum = 0;
    match A {
        1 => {
            for i in 0..=n {
                if i != BAD {
                    sum += i as u64
                }
            }
        }
        2 => {
            for i in InclusiveRangeIter::new(0, n) {
                if i != BAD {
                    sum += i as u64
                }
            }
        }
        3 => {
            let mut cur = 0;
            let mut done = false;
            while !done {
                let i = if cur < n {
                    let next = cur + 1;
                    std::mem::replace(&mut cur, next)
                } else {
                    done = true;
                    cur
                };
                if i != BAD {
                    sum += i as u64
                }
            }
        }
        4 => {
            let mut i = 0;
            while i < n {
                if i != BAD {
                    sum += i as u64
                }
                i += 1;
            }
            if n != BAD {
                sum += n as u64;
            }
        }
        5 => {
            let mut i = 0;
            if i != BAD {
                sum += i as u64;
            }
            loop {
                i += 1;
                if i != BAD {
                    sum += i as u64
                }
                if i == n { break }
            }
        }
        6 => {
            (0..=n).for_each(|i| {
                if i != BAD {
                    sum += i as u64;
                }
            });
        }
        7 => {
            sum = (0..=n).fold(0, |acc, i| {
                if i != BAD {
                    acc + i as u64
                } else {
                    acc
                }
            });
        }
        _ => { unreachable!() }
    }

   return sum
}

extern crate test;
#[bench]
fn sum_of_all_good_bench_1(b: &mut test::Bencher) {
    b.iter(|| sum_of_all_good::<1>(std::hint::black_box(1000000)));
}
#[bench]
fn sum_of_all_good_bench_2(b: &mut test::Bencher) {
    b.iter(|| sum_of_all_good::<2>(std::hint::black_box(1000000)));
}
#[bench]
fn sum_of_all_good_bench_3(b: &mut test::Bencher) {
    b.iter(|| sum_of_all_good::<3>(std::hint::black_box(1000000)));
}
#[bench]
fn sum_of_all_good_bench_4(b: &mut test::Bencher) {
    b.iter(|| sum_of_all_good::<4>(std::hint::black_box(1000000)));
}
#[bench]
fn sum_of_all_good_bench_5(b: &mut test::Bencher) {
    b.iter(|| sum_of_all_good::<5>(std::hint::black_box(1000000)));
}
#[bench]
fn sum_of_all_good_bench_6(b: &mut test::Bencher) {
    b.iter(|| sum_of_all_good::<6>(std::hint::black_box(1000000)));
}
#[bench]
fn sum_of_all_good_bench_7(b: &mut test::Bencher) {
    b.iter(|| sum_of_all_good::<7>(std::hint::black_box(1000000)));
}

fn main() -> std::io::Result<()> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s)?;
    let Ok(n) = s[..s.len() - 1].parse::<u32>() else {
        return Err(std::io::Error::other("Parse Error!"))
    };
    let val = std::hint::black_box(sum_of_all_good::<1>(n));
    println!("{val}");
    Ok(())
}
